<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>查看当前流程图</title>
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
</head>
<body id="style">
<!--<img id="img" style="position: absolute;top: 0px;left: 0px">-->

<!--<div id="style"></div>-->

<script src="../../lib/layui-v2.5.5/layui.all.js" charset="utf-8"></script>
<script src="../../js/common.js"></script>
<script>
    layui.use(['layer', 'form'], function(){
        var layer = layui.layer,
            form = layui.form,
            $ = layui.jquery;

        var taskId=getUrlParam("taskId");
        var flag=getUrlParam("flag");
        var data={
            'taskId':taskId,
            'selectId':flag
        }

        $.ajax({
            type: "post",
            dataType: "json",
            url: webUrl+'/task/showCurrentView',//url
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(data),
            success: function (result) {
                var html='';
                html+='<img id="img" style="position: absolute;top: 0px;left: 0px" src="'+webUrl+'/processDefinition/showView?deploymentId='+result.data.deploymentId+'&diagramResourceName='+result.data.diagramResourceName+'">';

                var currentList=result.data.currentList;
                var top,left, width,height;

                for(var i in currentList){
                    var current=currentList[i];
                    top=current.y-3,left=current.x-3,width=+current.width+3,height=current.height+3;
                    html+='<div style="position: absolute;border: 1px solid red;top:'+top+'px;left:'+left+'px;width:'+width+'px;height:'+height+'px;"></div>';
                }
                $("#style").html(html);            },
            error: function () {
                layer.msg("操作失败");
            }

        })
    });
    function getUrlParam(name) {
        var url = window.location.search; //获取url中"?"符后的字串
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                //就是这句的问题
                theRequest[strs[i].split("=")[0]] = decodeURI(strs[i].split("=")[1]);
                //之前用了unescape()
                //才会出现乱码
            }
        }
        return theRequest[name];
    }

</script>
</body>
</html>